<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="commontaglib"%>
<%
String path = request.getContextPath();

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
 
<html>
  <head>
    <link rel="stylesheet" href="<%=path%>/css/innerstyle.css" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/cupertino/jquery-ui.custom.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/ui.multiselect.css" />
    <script type="text/javascript" src="<%=path%>/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path%>/js/jquery-ui.custom.min.js"></script>  
    <script type="text/javascript" src="<%=path%>/js/i18n/grid.locale-cn.js"></script> 
    <script type="text/javascript" src="<%=path%>/js/jquery.jqGrid.min.js"></script>
    <script type="text/javascript" src="<%=path%>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>
    <style>
html, body {
	margin: 0;			 
	padding: 0;
	 
    font-size: 85%;
}
</style>
    
  </head>
    <script type="text/javascript">  
  function loadTab(){  
      $("#myTab").jqGrid({      
    url:'findBbJgrid.action',   
    datatype: 'json',
    mtype: 'post',         
   	colNames:['企业合同号', '出省站','车数','吨数','日期'],
   	colModel:[
   		{name:'hetbh',index:'hetbh', width:200},
   		{name:'yingyzmeijglz',index:'yingyzmeijglz', width:320 },
   		{name:'cheshu',index:'cheshu', width:120 },		
   		{name:'dunshu',index:'dunshu', width:120},		
   		{name:'tjrq',index:'tjrq', width:150, sortable:false}		
   	],
   
    jsonReader: {
           repeatitems : false, 
           id: 'pinpbh'
         },    	
   	rowNum:10,
   	rowList:[10,20,30],     	
   	pager: '#pager13',
   	rownumbers: true,   	 
    viewrecords: true,
    //multiselect: true,
    sortorder: 'desc', 
    loadError: function (r, st, error) {
    $("#message").html("status is " + r.status+error+st);
},
	caption: "列表"	
  });
  }

    $(function(){ 
    $("#xinz").button(); 
    $("#chax").button();
    $("#shanc").button();
    $( "#datepicker" ).datepicker($.datepicker.regional[ "zh-CN" ]);
    $( "#datepicker1" ).datepicker($.datepicker.regional[ "zh-CN" ]); 
    loadTab();    
    queryNum();
     $( "#tabs" ).tabs({
				    select: function(event, ui) {
				    
		  		  }	});
 });

// 查询
function search(){   
  var formdata = $("#form1").serialize();  
  $("#myTab").jqGrid('setGridParam',{url:'findBbJgrid.action?'+formdata,mtype:'post',page:1}).trigger("reloadGrid"); 
}


//计算成交金额函数
		function queryNum(){   
			  var formdata = $("#form1").serialize(); 
			  $.post("<%=path%>/bbgl/queryNum.action",formdata,function(data,textStatus)
			  {
			  
			  var json = eval('(' + data + ')');
			
			  var re=/(\d{1,3})(?=(\d{3})+(?:$|\.))/g;
		      if (json[0].ds !="")
               {
			     $("#queryNum").html("合计 单数："+json[0].ds + "条  车数："+json[0].ches.toString().replace(re,"$1,")+"车  吨数："+json[0].duns.toString().replace(re,"$1,")+"吨");
			   } else
                 {
                 $("#queryNum").html("合计 单数：0 条  车数： 0 车  吨数：0 吨");                 
                 } 
                 
                 });  
               }       
               

</script>
<body>  
<div id="best1">
<form id="form1" method="post">
<table id="list_search" cellpadding="0" cellspacing="0" border="0"> 
        <tr>
        	<td>
            	企业合同号:
            </td>
            <td>
            	<input type="text" class="longtextbox" name="bean.AA" /> 
            </td>
            <td>
                出省站:
            </td>
            <td>
            	<input type="text" class="longtextbox" name="bean.BB" />  
            </td>  
            <td>
            	日期:
            </td>
            <td>
            	<input id="datepicker" type="text" class="textbox" name="bean.CC" /> -- <input id="datepicker1" type="text1" class="textbox" name="bean.DD" />
            </td>        
            
        </tr>
		<tr>
        	<td>
            	车数:
            </td>
            <td>
            	<input id="datepicker" type="text" class="textbox" name="bean.EE" /> -- <input id="datepicker1" type="text1" class="textbox" name="bean.FF" />
            </td>
            <td>
            	吨数:
            </td>
            <td>
            	<input id="duns" type="text" class="textbox" name="bean.GG" /> -- <input id="duns1" type="text1" class="textbox" name="bean.HH" />
            </td>
            <td colspan="2"><input id="chax" type="button" value="查询" onclick="search();queryNum();"/></td>
            
        </tr>
  </table>
  </form>
    <div id="tabs">
      <ul>
            <li id="queryNum" style="float:right; vertical-align: bottom; line-height:33px; "></li>					
	   </ul>
    <table id="myTab" class="scroll" cellpadding="0" cellspacing="0"></table>  
   <div id="pager13" class="scroll"></div>  
   <div id="message" class="scroll"></div>
   </div> 
</div> 
<div id="dialog-confirm" title="是否确认删除？"></div>
</body>
</html>
